package com.damn;

import java.io.IOException;
import java.util.Calendar;
import java.util.Timer;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Schedular
 */
public class Schedular extends HttpServlet {
	private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Schedular() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see Servlet#init(ServletConfig)
	 */
	public void init(ServletConfig config) throws ServletException {
		// TODO Auto-generated method stub		
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub		
		/*
		String actionFlag = request.getParameter("actionFlag");
		if(actionFlag!=null && actionFlag.equalsIgnoreCase("start"))	{
			System.out.println("------------------Schedular Started----------------------");
			response.getWriter().println("Schedular Started");
			m1=new SchedularThread();
			thread.start();			
		}
		*/
		System.out.println("------------------Schedular Started----------------------");
		response.getWriter().println("Schedular Started");
		FBService fbServ = new FBService();
	    System.out.println("Generating report");
	    fbServ.initSchedulePost();	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.println("------------------Schedular Started----------------------");
		response.getWriter().println("Schedular Started");
		FBService fbServ = new FBService();
	    System.out.println("Generating report");
	    fbServ.initSchedulePost();
	}

}
